from selenium.webdriver.common.by import By


'''
    ID = "id"
    XPATH = "xpath"
    LINK_TEXT = "link text"
    PARTIAL_LINK_TEXT = "partial link text"
    NAME = "name"
    TAG_NAME = "tag name"
    CLASS_NAME = "class name"
    CSS_SELECTOR = "css selector"
'''

class Elements():
    '''
    首页的元素
    '''
    #首页的登录按钮，点击跳转到登录页面
    TO_LOGIN_BUTTON = (By.LINK_TEXT,'登录')
    # 搜索输入框
    SEARCH_INPUT = (By.XPATH,'//*[@id="app"]/div/div[1]/div[2]/div[2]/div[1]/div/input')
    # 搜索按钮
    SEARCH_BTN = (By.XPATH,'//*[@id="app"]/div/div[1]/div[2]/div[2]/div[1]/div/div/button')
    # 发布二手物品 按钮
    FABU_BTN = (By.XPATH,'//*[@id="app"]/div/div[1]/div[2]/div[2]/div[2]/button[1]')

    # 个人中心按钮
    MEMBER_INFO_LI = (By.XPATH,"//ul[contains(@class, 'el-dropdown-menu')]//li[div[text()='个人中心']]")

    '''
    登录界面元素
    '''
    # 登录按钮
    LOGIN_BTN_ELE = (By.XPATH, '//*[@id="app"]/div/div/div/div/form/div[3]/button[1]')
    HOUSE_LOGIN_BTN_ELE = (By.XPATH,'/html/body/div/div/div/div[3]/div[2]/button')
    # 用户名输入框
    USER_NAME_ELE = (By.XPATH, '//*[@id="app"]/div/div/div/div/form/div[1]/input')
    HOUSE_USER_NAME_ELE = (By.XPATH, '/html/body/div/div/div/div[3]/form/div[1]/div/div/div/input')

    # 密码输入框
    PASSWORD_ELE = (By.XPATH, '//*[@id="app"]/div/div/div/div/form/div[2]/input')
    HOUSE_PASSWORD_ELE = (By.XPATH, '/html/body/div/div/div/div[3]/form/div[2]/div/div[1]/div/input')
    HOUSE_PUTONG_USER_TYPE = (By.XPATH,'/html/body/div/div/div/div[3]/form/div[3]/div/div/label[1]/span[2]')
    HOUSE_FANGDONG_USER_TYPE = (By.XPATH, "/html/body/div/div/div/div[3]/form/div[3]/div/div/label[2]/span[1]")

    #注册按钮
    TO_REG_BTN = (By.XPATH,'//*[@id="app"]/div/div/div/div/form/div[3]/button[2]')

    '''
    注册界面元素
    '''
    INPUT_NAME = (By.XPATH,'//*[@id="app"]/div/div/div/div/div[2]/input')
    INPUT_PHONE = (By.XPATH, '//*[@id="app"]/div/div/div/div/div[3]/input')
    INPUT_PASSWORD1 = (By.XPATH, '//*[@id="app"]/div/div/div/div/div[4]/input')
    INPUT_PASSWORD2 = (By.XPATH, '//*[@id="app"]/div/div/div/div/div[5]/input')
    REG_BTN = (By.XPATH, '//*[@id="app"]/div/div/div/div/div[6]/button[1]')

    '''
    搜索完成页面
    '''
    # 第一个商品
    FIRST_PRODUCT = (By.XPATH, '//*[@id="app"]/div/div[2]/div/div[1]/div[1]/div/div[1]/div')

    '''
    发布二手物品页面
    '''
    # 请输入二手物品名称
    PRODUCT_NAME_INPUT = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[1]/input')
    # 请输入物品的详细介绍...
    PRODUCT_DETAIL_INPUT = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[2]/textarea')
    # 选择地区
    AREA_INPUT_SELECT = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[3]/div[2]/div/input')
    # 省份选择
    PROVINCE_SELECT = (By.CSS_SELECTOR,'.el-cascader-node')
    PROVINCE_CSS_SELECT = (By.CSS_SELECTOR, '.el-cascader-node')
    # 城市选择
    CITY_SELECT = (By.XPATH, '//*[@id="cascader-menu-2219-1-0"]')
    # 区域选择
    AREA_SELECT = (By.XPATH, '//*[@id="cascader-menu-3112-2-0"]')
    # 物品类别
    PRODUCT_TYPE_SELECT =(By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[4]/div[1]/div[2]/div/input')
    #类别1
    PRODUCT_TYPE_1 = (By.XPATH,"/html/body/div[3]/div[1]/div[1]/ul/li[1]/span")
    # 价格输入框
    PRICE_INPUT = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[4]/div[2]/div/div/input')
    # 点击上传文件
    UPLOAD_INPUT =(By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[5]/div[2]/div/div')
    # 确认发布按钮
    COMFIRM_BUTON = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[6]/button')

    '''
    商品详情页面
    '''

    # 立即购买 按钮
    BUY_BTN = (By.XPATH, '//*[@id="app"]/div/div[2]/div/div[1]/div[1]/div[2]/button[1]')
    # 收藏 按钮
    SHOUCANG_BTN = (By.XPATH, '//*[@id="app"]/div/div[2]/div/div[1]/div[1]/div[2]/button[2]')
    # 登录后，用户名
    NICK_NAME_ELE = (By.CSS_SELECTOR,'.nickname')
    # 发布者的用户名
    FABU_USER = (By.CSS_SELECTOR,'.details-header-user-info-nickname')


    '''
    下单界面
    '''
    # 取消订单按钮
    CANCEL_BTN = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[5]/button[1]')
    # 立即支付按钮
    PAY_BTN = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[5]/button[2]')
    # 弹框的模拟支付按钮
    ALERT_PAY_BTN = (By.XPATH,'/html/body/div[2]/div/div[3]/button[2]')
    # 弹出的消息框
    ALERT_MSG_ELE =(By.XPATH,'/html/body/div[2]/div/div[2]/div[1]/div[2]')
    # 订单信息标题
    # <div data-v-8b2a0244="" data-v-15d0c2de="" class="order-info-title">订单信息（待发货）：</div>
    ORDER_INFO_TITLE = (By.CSS_SELECTOR,'.order-info-title')





    '''
    用户中心界面
    '''
    # 下架按钮
    XIAJIA_BUNNTON = (By.XPATH, '//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/div/div[2]/div[4]/button')
    # 下架确认按钮
    CONFIRM_BTN =(By.XPATH,'/html/body/div[2]/div/div[3]/button[2]')
    # 我下架的tab标签
    XIAJIA_TAB = (By.XPATH,'//*[@id="tab-2"]')
    # 我的收藏
    MY_STAR_TAB = (By.XPATH,'//*[@id="tab-3"]')
    # 取消收藏按钮
    CANCEL_STAR_BTN = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/div/div[2]/div[4]/button')
    # 我卖出的
    MY_SELL_OUT = (By.XPATH,'')
    # 我买到的
    MY_BUY = (By.XPATH,'')



    '''
    房源列表
    '''
    HOUSE_LIST_MENU = (By.XPATH,'/html/body/div[1]/div[1]/section/aside/ul/li[2]/div/span')

    HOUSE_LIST_LINK = (By.XPATH, '/html/body/div[1]/div[1]/section/aside/ul/li[2]/ul/li/ul/li[1]')

    HOUSE_SEARCH_INPUT = (By.XPATH,'/html/body/div[1]/div[1]/section/section/div[2]/div[1]/div/div/form/div[1]/div/div/div/input')

    HOUSE_SEARCH_BTN = (By.XPATH,'/html/body/div[1]/div[1]/section/section/div[2]/div[1]/div/div/form/div[3]/div/button/span')

    HOUSE_TABLE_INFO = (By.XPATH, '/html/body/div[1]/div[1]/section/section/div[2]/div[2]/div/div[1]/div[3]/div/div[1]/div/table/tbody')



    '''
    在租列表
    '''
    HOUSE_ZU_MENU = (By.XPATH, '/html/body/div/div[1]/section/aside/ul/li[3]/div/span')
    HOUSE_ZU_LINK = (By.XPATH, '/html/body/div/div[1]/section/aside/ul/li[3]/ul/li/ul/li[1]')
